#include<iostream>
#include"comm.hpp"
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<string>
int main()
{
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd<0)
    {
        std::cout<<"open file fail!"<<std::endl;
    }
    std::cout<<"open file success!"<<std::endl;
    std::string message;
    int cnt = 1;
    pid_t id = getpid();
    while(true)
    {
        std::cout<<"Please enter#";
        std::getline(std::cin,message);
        message += ",message number:" + std::to_string(cnt++) + ",pid="+"[" + std::to_string(id) + "]";
        write(fd,message.c_str(),message.size());
        

    }
    return 0;
}